﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {

        public Window1()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(Window1_Loaded);

            this.TitleBar.MouseLeftButtonDown += new MouseButtonEventHandler(Window1_MouseLeftButtonDown);
            this.Activated += new EventHandler(Window1_Activated);
            this.Deactivated += new EventHandler(Window1_Deactivated);
            //this.MouseEnter += new MouseEventHandler(Window1_MouseEnter);
            //this.MouseLeave += new MouseEventHandler(Window1_MouseLeave);
            this.btnMinimize.Click += new RoutedEventHandler(btnMinimize_Click);
            this.btnClose.Click += new RoutedEventHandler(btnClose_Click);
        }

        void btnClose_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }

        void btnMinimize_Click(object sender, RoutedEventArgs e)
        {
            this.WindowState = WindowState.Minimized;
        }

        void Window1_Activated(object sender, EventArgs e)
        {
            this.TitleBar.Background = (Brush)Resources["ActiveTitleBarBrush"];
            this.lblDrag.Foreground = (Brush)Resources["ActiveTitleBrush"];
        }

        void Window1_Deactivated(object sender, EventArgs e)
        {
            this.TitleBar.Background = (Brush)Resources["InactiveTitleBarBrush"];
            this.lblDrag.Foreground = (Brush)Resources["InactiveTitleBrush"];
        }

        void Window1_Loaded(object sender, RoutedEventArgs e)
        {
        }

        void Window1_MouseLeave(object sender, MouseEventArgs e)
        {
            //this.InactiveStoryBoard.Storyboard.Begin();
            //this.Opacity = .5;
        }

        void Window1_MouseEnter(object sender, MouseEventArgs e)
        {
            //this.ActiveStoryBoard.Storyboard.Begin();
            //this.Opacity = 1;
        }

        void Window1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }

    }
}
